This page provides a few proposition to visualize a dataset composed of 3 numeric variables. Two dataset are considered. The Gapminder dataset provides the average life expectancy, gdp per capita and population size for more than 100 countries. The volcano dataset provides the Topographic Information on Auckland’s Maunga Whau Volcano.
# Libraries
library(tidyverse)
library(hrbrthemes)
library(viridis)
library(DT)
library(plotly)
# The dataset is provided in the gapminder library
library(gapminder)
# Show a bubbleplot
p <- gapminder %>%
filter(year==2007) %>%
mutate(pop=pop/1000000) %>%
arrange(desc(pop)) %>%
mutate(country = factor(country, country)) %>%
ggplot( aes(x=gdpPercap, y=lifeExp, size = pop, color = continent)) +
geom_point(alpha=0.7) +
scale_size(range = c(1.4, 12)) +
scale_color_viridis(discrete=TRUE) +
theme_ipsum()
ggplotly(p)
plot_ly(z = volcano, type = "surface")
A work by Yan Holtz for data-to-viz.com